#ifndef __VIEW_ENV_H
#define __VIEW_ENV_H

#include <driver/view/view.h>
#include <driver/view/screen.h>
#include <driver/view/msg.h>
#include <lib/type.h>

int ViewEnvInit();
int ViewEnvExit();

uint32_t ViewEnvGetLastPos();
uint32_t ViewEnvGetMousePos();
uint32_t ViewEnvGetScreenSize();

int ViewEnvTryResizeEx(view_t *view, int width, int height);
int ViewEnvTryResize(view_t *view, view_rect_t *rect);

int ViewEnvAddTimer(view_t *view, uint32_t interval);
int ViewEnvRestartTimer(view_t *view, uint32_t timer_id, uint32_t interval);
int ViewEnvDelTimer(view_t *view, uint32_t timer_id);

int ViewEnvCheckMonitorExit(view_t *view);
int ViewEnvSetMonitor(view_t *view, int is_montor);
int ViewEnvSendToMonitor(view_t *view, int mid, int arg);

int ViewEnvDoDrag(view_t *view, view_msg_t *msg, int local_mx, int local_my);
void ViewEnvDoMouseHover(view_t *view, view_msg_t *msg, int local_mx, int local_my);

int ViewEnvTryActivity(view_t *view);
view_t *ViewEnvGetActivity();

view_t *ViewEnvGetMiddle();
void ViewEnvSetMiddle(view_t *view);
int ViewEnvResetHoverAndActivity();

int ViewEnvFilterMouseMsg(view_msg_t *msg);

int ViewEnvGetWinmaximRect(view_rect_t *rect);
int ViewEnvSetWinmaximRect(view_rect_t *rect);
int ViewCalcResize(view_t *view, int mx, int my, view_rect_t *out_rect);
int ViewEnvDoResize(view_t *view, view_msg_t *msg, int local_mx, int local_my);

#endif